package com.ruoyi.comment.domain;

import com.fasterxml.jackson.annotation.JsonFormat;
import com.ruoyi.common.annotation.Excel;
import com.ruoyi.common.core.domain.BaseEntity;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;

import java.util.ArrayList;
import java.util.Date;
import java.util.List;

/**
 * 评论信息对象 comment
 *
 * @author lin
 * @date 2024-11-22
 */
public class Comment extends BaseEntity
{
    private static final long serialVersionUID = 1L;

    /** 评论ID */
    private Long id;

    /** 评论内容 */
    @Excel(name = "评论内容")
    private String content;

    /** 评论作者ID */
    @Excel(name = "评论作者ID")
    private Long userId;

    @Excel(name = "评论时间")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    private Date createTime;

    /** 是否删除（0：未删除；1：已删除） */
    @Excel(name = "是否删除", readConverterExp = "0=：未删除；1：已删除")
    private Long isDelete;

    /** 商品ID */
    @Excel(name = "商品ID")
    private Long productId;

    /** 父评论ID */
    @Excel(name = "父评论ID")
    private Long parentId;

    /** 根评论ID */
    @Excel(name = "根评论ID")
    private Long rootParentId;

    /** 本评论下的子评论 */
    @Excel(name = "本评论下的子评论")
    private List<Comment> child;

    public void setId(Long id)
    {
        this.id = id;
    }

    public Long getId()
    {
        return id;
    }
    public void setContent(String content)
    {
        this.content = content;
    }

    public String getContent()
    {
        return content;
    }
    public void setUserId(Long userId)
    {
        this.userId = userId;
    }

    public Long getUserId()
    {
        return userId;
    }
    public void setIsDelete(Long isDelete)
    {
        this.isDelete = isDelete;
    }

    public Long getIsDelete()
    {
        return isDelete;
    }
    public void setProductId(Long productId)
    {
        this.productId = productId;
    }

    public Long getProductId()
    {
        return productId;
    }
    public void setParentId(Long parentId)
    {
        this.parentId = parentId;
    }

    public Long getParentId()
    {
        return parentId;
    }
    public void setRootParentId(Long rootParentId)
    {
        this.rootParentId = rootParentId;
    }

    public Long getRootParentId()
    {
        return rootParentId;
    }

    @Override
    public String toString() {
        return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
            .append("id", getId())
            .append("content", getContent())
            .append("userId", getUserId())
            .append("createTime", getCreateTime())
            .append("isDelete", getIsDelete())
            .append("productId", getProductId())
            .append("parentId", getParentId())
            .append("rootParentId", getRootParentId())
            .toString();
    }

    public List<Comment> getChild() {
        return child;
    }

    public void setChild(ArrayList<Comment> child) {
        this.child = child;
    }
}
